import pygame
from pygame.locals import *
from sys import exit

image_filename = 'pygame.jpg'

pygame.init()
screen = pygame.display.set_mode((400, 300))
pygame.display.set_caption("Moving with arrows")
img = pygame.image.load(image_filename)
x = 0
y = 150
while True:
    screen.fill((255, 255, 255))
    screen.blit(img, (x, y))
    for event in pygame.event.get():
        if event.type == QUIT:
            exit()
        if event.type == KEYDOWN:
            if event.key == K_d:
                x = x + 5
            if event.key == K_a:
                x = x - 5
            if event.key == K_x:
                y = y + 5
            if event.key == K_w:
                y = y - 5
            if event.key == K_z:
                x = x - 5
                y = y + 5
            if event.key == K_c:
                x = x + 5
                y = y + 5
            if event.key == K_e:
                x = x + 5
                y = y - 5
            if event.key == K_q:
                x = x - 5
                y = y - 5
    pygame.display.update()
